﻿using UnityEngine;
using System.Collections;

namespace HotUI{
	public abstract class LuaViewCommand{
		public LuaView view;
		public void SetView(LuaView _view){
			view = _view;
		}
		public virtual void Do(){
		}
	}
	public class LVC_LuaInit:LuaViewCommand{
		string key;
		System.Action<string> callback;
		public LVC_LuaInit(string _key,System.Action<string> _callback){
			key = _key;
			callback = _callback;
		}
		public override void Do ()
		{
			base.Do ();

			callback ("lua_ui_" + view.name);
		}
	}
	public class LVC_UpdateDepth:LuaViewCommand{
		int depth;
		public LVC_UpdateDepth(int _depth){
			depth = _depth;
		}
		public override void Do ()
		{
			base.Do ();
			view.UpdateDepth(depth);
		}
	}
	public class LVC_UpdateSlider:LuaViewCommand{
		string key;
		float value;
		public LVC_UpdateSlider(string _key,float _value){
			key = _key;
			value = _value;
		}
		public override void Do(){
			if(view != null)
				view.myobj.SetSlider (key, value);
		}
	}
}